<template>
  <div id="app">
    <!-- <texst1/> -->
  <!-- <text-2/> -->

  <!-- 父传子 -->
<!-- <text3 name="浩海" :age='20' :person='p' :logperson="logp" @btndata='btn'/> -->

  <!-- 利用PubSub库进行传值-->
  <!-- <text4/> -->

  <!-- vue路由-->
  <div>
    <router-link to="/text5">首页</router-link>
    <router-link to='/text6'>我的</router-link>
  </div>
<router-view></router-view>
  </div>
</template>

<script>
// import text1 from './components/text1.vue'
// import text2 from './components/text2.vue'
// import text3 from './components/text3.vue'
// import text4 from './components/text4.vue'
 // import PubSub from 'pubsub-js'

export default {
  name: 'App',
  components: {
    // text1
    // text2
	// text3
  // text4
  },
  data(){
    return{
      p:{
        name:'张三',
        age:25
      }
    }
  },
  methods:{
    logp(name,age){
      alert('父组件传来的')
      alert(`${name},${age}`)
    },
    btn(data){
      console.log(data)
    }
  },
  mounted() {
    // 订阅消息
    // PubSub.subscribe('btndata',(msg,t)=>{
    //   console.log(msg,t)
    // })
  }
}
</script>

<style>
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
